package text111;

public class Solution23 {
	 public ListNode deleteNode(ListNode head, int val) {
		 	ListNode pNode,qNode;
		 	//保存head前驱
		 	qNode = head;
			//保存head节点
		 	pNode = head;
		 	if (head.val==val) {
				pNode = head.next;
				return pNode;
			}else {
				head = head.next;
			}
		 	//head = head.next;
		 		while(head!=null) {
		 			if (head.val==val) {
						pNode.next = head.next;
					}
		 			head = head.next;
		 			pNode = pNode.next;
		 		}
				return qNode;
	    }
}
